home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / SoundAndMusic / cmix / lib / tablei.c < prev    next >
C/C++ Source or Header  |  1990-01-06  |  359b  |  17 lines

  1.  
  2. float tablei(nsample,array,tab)
  3.  
  4. long nsample;
  5. float *array,*tab;
  6.  
  7. {
  8.     register loc1,loc2;
  9.         float frac = ((float)(nsample)/(*tab)) * *(tab+1);
  10.     if(frac < 0) return(array[0]);
  11.     if(frac >= *(tab+1)) return(array[(int)*(tab+1)]);
  12.     loc1 = frac;
  13.     loc2 = loc1+1;
  14.     frac = frac - (float)loc1;
  15.     return(*(array+loc1) + frac * (*(array+loc2) - *(array+loc1)));
  16. }
  17.